﻿using CleanArchitecture.Infrastructure.Entities.AdminUsers;
using CleanArchitecture.Infrastructure.Entities.SystemModules;
using System.Collections.Generic;

namespace CleanArchitecture.Infrastructure.Interfaces.SystemManage
{
    public partial interface ISystemModuleService
    {
        /// <summary>
        /// DavidLee 2019/12/22 更改菜单加载逻辑，
        /// 全量加载，在用户点击时判断用户是否有操作权限
        /// </summary>
        /// <param name="loginUser">当前登录用户</param>
        /// <returns></returns>
        IList<SystemModule> GetSystemMenusAll();

        /// <summary>
        /// 根据用户角色权限查询菜单
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        IList<SystemModule> GetSystemMenuByUser(AdminUser user);

        SystemModule GetSystemModuleById(int moduleid);
        /// <summary>
        /// 根据系统模块url获取系统模块记录
        /// </summary>
        /// <param name="moduleUri"></param>
        /// <returns></returns>
        SystemModule GetSystemModuleByUri(string moduleUri);
        /// <summary>
        /// Get Mapping List By AdminRole Ids
        /// </summary>
        /// <param name="roleIds"></param>
        /// <returns></returns>
        IList<AdminRoleSystemModuleMapping> GetAdminRoleSystemModuleMappingsByRoleIds(int[] roleIds);

        void UpdateAdminRoleAuthorize(IList<AdminRoleSystemModuleMapping> mappings);
        /// <summary>
        /// Insert entity
        /// </summary>
        /// <param name="module"></param>
        void InsertSystemModule(SystemModule module);
        /// <summary>
        /// Update entity change to database
        /// </summary>
        /// <param name="module"></param>
        void UpdateSystemModule(SystemModule module);
        /// <summary>
        /// Delete entity
        /// </summary>
        /// <param name="module"></param>
        void DeleteSystemModule(SystemModule module);
    }
}
